package thread.lock;

import thread.ThreadUtils;

import java.util.concurrent.locks.LockSupport;

public class LockSupportTest {
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            System.out.println(1);
            ThreadUtils.sleep(1000);
            System.out.println(2);
            LockSupport.park("我被停止了");//线程停止
            System.out.println(3);
        });
        thread.start();
        ThreadUtils.sleep(5000);
        System.out.println("5秒过去了");
        Object blocker = LockSupport.getBlocker(thread);
        System.out.println(blocker);


//        LockSupport.unpark(thread); //线程运行 给实例参数


    }
}
